import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};
export type infoType = {
	id?: number,
	messageType?: number,
	readStatus?: number,
	content?: string,
	taskName?: string,
	nickname?: string,
	createdAt?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
  result:any;
  res:any
};
const List = '/business/message/v2/messages';
const Url = '/business/message/v2/message';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
//消息详情
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
}
//消息未读数量 
export const getCount = (params?: object) => {
    return http.request<commonResult<any>>("get", "/business/message/v2/no-read-count", {
        params
      });
}
//一键已读
const readAll = '/business/message/v2/on-touch-read';
export const readAllFun = (data?: object) => {
    return http.request<commonResult<infoTypeList>>("post", readAll, {
        data
      });
}
//删除消息
const deleteMessage = '/business/message/v2/messages';
export const deleteMessageFun = (data?: object) => {
    return http.request<commonResult<infoTypeList>>("delete", deleteMessage, {
        data
      });
}
//消息类型 
export const messagetype = (data?: object) => {
  return http.request<commonResult<any>>("get", "/business/message/v2/message-type", {
      data
    });
}
